/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tdtest.action;

import tdtest.controls.ControlFactory;
import tdtest.data.TDList;

/**
 *
 * @author sutter
 */
public class AddListItem<T> implements Action {
	
	private TDList<T> list;
	private ControlFactory<T> controlFactory;
	
	public AddListItem(TDList<T> list, ControlFactory<T> controlFactory) {
		this.list = list;
		this.controlFactory = controlFactory;
	}
	
	public void run() {
		T data = controlFactory.createObject();
		list.groupItems.add(data);
		list.onUpdate();
	}
	
}
